#include "Common.h"
#include "ThreadCache.h"

static void* ConcurrentAlloc(size_t size)// static 防止多个cpp引用此头文件导致链接时的重定义错误
{
	if (pTLSThreadCache == nullptr)
	{
		pTLSThreadCache = new ThreadCache;
	}
	//cout << std::this_thread::get_id() << ":" << pTLSThreadCache << endl;//验证TLS可以给每个线程分配不同的独立变量
	return pTLSThreadCache->Allocate(size);
}

static void ConcurrentFree(void *ptr, size_t size)// 按道理说，不应要求size参数，此问题日后解决
{
	assert(pTLSThreadCache);
	pTLSThreadCache->Deallocate(ptr, size);

}
